/*** 
 * @Author: Wrz
 * @version: g++ -std=c++17
 * @Date: 2021-10-14 11:13:48
 * @LastEditors: Wrz
 * @LastEditTime: 2021-10-14 13:57:51
 */
#include "src/Generator.cpp"
#include <bits/stdc++.h>

using namespace std;

mt19937 rng((unsigned int)chrono::steady_clock::now().time_since_epoch().count());

constexpr int mxN = 1e5 + 5;
int a[mxN];

function<void()> input = []()
{
    int n = rng() % 1000;
    cout << n << endl;

    for (int i = 0; i < n; ++i) a[i] = rng() % 100;

    for (int i = 0; i < n; ++i) cout << a[i] << " \n"[i == n - 1];
    int c = rng() % 100;
    cout << c << endl;
};

void ImplementSolution();
function<void()> solution = ImplementSolution;

int main()
{
    setWorkspace(".\\1005\\");

    int normal = 6;
    for (int i = 1; i <= normal; ++i)
    {
        data_generator.make_input("", i, "in", input, "");
    }

    int bad = 4;
    for (int i = normal + 1; i <= normal + bad; ++i)
    {
        data_generator.make_bad_input("", i, "in", input, "");
    }

    for (int i = 1; i <= normal + bad; ++i)
    {
        solver.make_output("", i, "out", solution, "");
    }

    return 0;
}

void ImplementSolution()
{
  int n;
  cin >> n;
  vector<int> a(n);
  int mx = -1;
  for (int i = 0; i < n; ++i) cin >> a[i], mx = max(mx, a[i]);
  int c;
  cin >> c;
  int cnt = 0;
  for (int i = 0; i < n; ++i)
    if (mx - a[i] <= c) {
        assert(cnt <= INT_MAX);
        ++cnt;

    }

  cout << cnt << '\n';
}